<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@include file="../common/jspcommon.jsp"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<%@include file="../common/jscss.jsp"%>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>果果街--找回密码</title>

<script type="text/javascript">
	$(function(){
		$(':input').bind('keyup', function(event){
		   if (event.keyCode=="13"){
			   findPassword();
		   }
		});
		
		$("#email").val('');
		$("#yanZhengMa").val('');
		$("#yzm_src").attr("src","img.htm?time="+(new Date()).getTime());
		
		$("#email").blur(function(){
			var re = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
			if($(this).val()==""){
				$("#notice_error").html("邮箱不能为空").show();
			}else if(!re.test($(this).val())){
				$("#notice_error").html("邮箱格式不正确").show();
			}else if($(this).val().length>50){
				$("#notice_error").html("邮不能超过50个字符").show();
			}
		});
		
		$("#email").focus(function(){
			$("#notice_error").html("");
		});
		
		$("#yanZhengMa").blur(function(){
			if($(this).val()==""){
				$("#notice_error_code").html("请输入验证码").show();
			}
		});
		
		$("#yanZhengMa").focus(function(){
			$("#notice_error_code").html("");
		});
		
	});
	function findPassword(){
		var re = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
		var email = $("#email").val();
		var code = $("#yanZhengMa").val();
		if(email==""){
			$("#notice_error").html("邮箱不能为空").show();
		}else if(!re.test(email)){
			$("#notice_error").html("邮箱格式不正确").show();
		}else if(email.length>50){
			$("#notice_error").html("邮箱不能超过50个字符").show();
		}else if(code==""){
			$("#notice_error_code").html("请输入验证码").show();
		}else{
			$("#saveButton").attr("onclick","");
			$.post("findPassword.htm",{email:email,code:code},function(data){
				if(data=='success'){
					$("#notice_error").html("");
					$("#notice_error_code").html("");
					$("#gotoEamil").show();
					$("#inputEmail").hide();
					$("#a_email").text(email);
				}else if(data=='codeError'){
					$("#notice_error_code").html("请重新输入验证码");
					$("#yzm_src").attr("src","img.htm?time="+(new Date()).getTime());
					$("#saveButton").attr("onclick","findPassword()");
				}else{
					$("#saveButton").attr("onclick","findPassword()");
					$("#notice_error").html("您输入的邮箱不是注册用户");
				}
			});
		}
	}
	
	
</script>
</head>
<body>
<%@include file="../common/header.jsp" %>
<div class="wraper">
		
	</div>
	<div class="center_line"></div>
	<div class="helpTopicWraper" id="gotoEamil" style="display: none">
		<div class="rightSetPsdContent" >
           	 
              <div class="setPsdContent">
                	<img src="imgs/setPsdPic01.png" alt="" />
                    <p>请到您的邮箱<font  id="a_email"></font>设置新密码 <span>请在10分钟内点击邮箱中的密码重置链接，即可进行密码重置</span></p>
                   
              </div>
              <h2 class="introH3">&nbsp;</h2>
         	 </div>
     </div>
	 <div class="helpTopicWraper" id="inputEmail">
	 	<!-- 去邮箱改密码 -->
	 		
         	 
        	<div class="righthelpTopicHeadBg">
            	<img src="imgs/cornerlt_content.png" title="" class="rightCircleHeadLeft" />
                <img src="imgs/corner_content.png" title="" class="rightCircleHeadRight" />
            </div>
            <form action="" id="findPwdForm">
            <div class="rightFindPsdContent" id="findPassword">
           	  <h3><a href="#" title="" class="myFindPsd">通过邮箱找回密码</a></h3>
              <div class="findPsdOpe">
                <p>
                   <span class="findPsdspan">注册邮箱：</span>
                   <input type="text" id="email" name="email" >
                </p>
                <div style="color:red;display:none;padding:0px 0px 0px 68px;" id="notice_error"></div>
                <p class="findPsdStyle">
                	<span class="findPsdFont">验证码：</span>
                    <input type="text" id="yanZhengMa" value=""><img src="" id="yzm_src" align="top">
                </p>
                <div style="color:red;display:none;padding:0px 0px 0px 68px;" id="notice_error_code"></div>
                <p class="findPsdInfo">输入您登陆果果街的邮箱及验证码，点击发送按钮即可重新设置密码。<br />
                  出于安全考虑请在10分钟内完成。</p>
                <p class="findPsdSend"><a href="javascript:void(0)" title="" id="saveButton" onclick="findPassword();"><img src="imgs/findPsd01.png" alt="" /></a></p>
              </div>
              <h2 class="introH3">&nbsp;</h2>
          </div>
         </form>
            <div class="rightHelpBottomBg">
            	<img src="imgs/cornerlb.png" title="" class="rightCircleBottomLeft" />
                <img src="imgs/cornerrb.png" title="" class="rightCircleBottomRight" />
            </div>
        </div>
	
	<%@include file="../common/footer.jsp"%>
</body>
</html>
